/*
===========================================================================
This source file is part of DyLab (Dynamic Laboratory)
For the latest info, see http://dylab.googlecode.com

Copyright (c) 2006-2008 Lukas Krejci
(krejci.lukas@volny.cz)

This file is part of DyLab.

    DyLab is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    DyLab is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with DyLab.  If not, see <http://www.gnu.org/licenses/>.
===========================================================================
*/

#ifndef __dylab_IComponent_h__
#define __dylab_IComponent_h__

//===========================================================================================
#include <dylab/utils/property/PropertyTree.h>

//===========================================================================================
namespace dylab {

    /** Common interface of all components.
     */
    class DYLAB_EXPORT IComponent
    {
    public:
		// creating & deleting have to be controlled from one place (in order to prevent cross-dll memory issues)
        static void * operator new(size_t _size);
        static void operator delete(void * _component);

		/// Helper method for retrieving the component name from the given property tree.
		static String loadComName(const PropertyTree & _pt)
				{ return _pt.getNodeValue("@com"); }

    public:

        virtual ~IComponent()
                { }

        /** The component should return the component description string.
        */
        virtual String getDescription() const = 0;

        /** The component should return its name.
        */
        virtual String getName() const = 0;

        /** The component should return its the full name (i.e., "type.name")
        */
        virtual String getFullName() const = 0;

        /** The component should load itself from the given property tree.
        */
		virtual void loadFromPropertyTree(const PropertyTree & _pt) = 0;
    };
}

//===========================================================================================
#endif // __dylab_IComponent_h__
